<!DOCTYPE html>
<html>
<head>
<title>I LOVE U</title>
<style>
body {
  margin: 0;
  overflow: hidden;
  background-color: black;
}

#heart-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.heart {
  position: absolute;
  width: 30px;
  height: 30px;
  transform: rotate(-45deg);
  animation: flutter 4s linear infinite, glow 1.5s alternate infinite;
  will-change: transform, opacity;
}

@keyframes flutter {
  0% {
    transform: translateY(0) translateX(0) rotate(-45deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(calc(100vh + 30px)) translateX(var(--random-x)) rotate(calc(360deg * var(--random-rotate) - 45deg));
    opacity: 0;
  }
}

@keyframes glow {
  0% {
    filter: drop-shadow(0 0 5px pink);
  }
  100% {
    filter: drop-shadow(0 0 20px lightpink);
  }
}

#love-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 5em;
  font-family: sans-serif;
  color: lightblue;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  animation: fadeInOut 4s ease-in-out infinite, textGlow 1.5s alternate infinite;
  opacity: 0.8;
}

@keyframes fadeInOut {
  0%, 100% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

@keyframes textGlow {
  0% {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  }
  100% {
    text-shadow: 2px 2px 10px rgba(0, 173, 216, 0.8);
  }
}
</style>
</head>
<body>

<div id="heart-container"></div>
<div id="love-text">I LOVE U</div>

<script>
const heartContainer = document.getElementById('heart-container');
const targetHeartCount = 100;
let heartCount = 0;

function createHeart() {
  const heart = document.createElement('div');
  heart.className = 'heart';
  
  heart.innerHTML = `
    <svg viewBox="0 0 24 24" fill="pink">
      <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>
    </svg>
  `;

  const randomX = Math.random() * 100 - 50;
  const randomRotate = Math.random();

  heart.style.setProperty('--random-x', `${randomX}vw`);
  heart.style.setProperty('--random-rotate', randomRotate);

  heart.style.left = `${Math.random() * 100}vw`;
  heart.style.top = `${Math.random() * 100}vh`;

  heartContainer.appendChild(heart);
  heartCount++;

  heart.addEventListener('animationend', () => {
    heart.remove();
    heartCount--;
  });
}

// 初始填充心形
while (heartCount < targetHeartCount) {
  createHeart();
}

// 定时检查心形数量，并进行补充
setInterval(() => {
  while (heartCount < targetHeartCount) {
    createHeart();
  }
}, 50);
</script>
</body>
</html>